package client;

import java.rmi.RemoteException;
import java.util.Date;

import logic.Document;
import logic.DocumentDescription;
import logic.Report;
import logic.Template;
import net.retrievers.Retriever;
import net.rmi.List;
import net.rmi.Logon;
import net.rmi.Reporter;
import server.GlobalConfig;
import server.ServerRetriever;

public class LocalFactory extends Factory {

	@Override
	public Retriever<Document> getDocumentRetriever() {
		return new ServerRetriever<Document>(GlobalConfig.DOCUMENT);
	}

	@Override
	public List getList() {

		return new List() {

			public java.util.List<DocumentDescription> list(String type, String user) throws RemoteException {
				return server.List.list(type, user);
			}
		};
	}

	@Override
	public Logon getLogon() {
		return new Logon() {

			public String logon(String username, String remixPass, String openKey) throws RemoteException {
				return server.Logon.logon(username, remixPass, openKey);
			}

		};
	}

	@Override
	public Reporter getReporter() {
		return new Reporter() {

			public Report report(String agent, String field, Date dateStart, Date dateEnd) throws RemoteException {
				return server.Reporter.report(agent, field, dateStart, dateEnd);
			}

		};
	}

	@Override
	public Retriever<Template> getTemplateRetriever() {
		return new ServerRetriever<Template>(GlobalConfig.TEMPLATE);
	}

}
